<?php

namespace App\Http\Controllers;

use App\Http\Requests\LiuyanRequest;
use App\Liuyan;
use Illuminate\Http\Request;

class IndexController extends Controller
{
    public function index(){
        return view('index');
    }
    public function submit(LiuyanRequest $request){

       $liuyan= new Liuyan();
       $liuyan->name=$request->name;
       $liuyan->mobile=$request->mobile;
       $liuyan->desc=$request->desc;
       $liuyan->save();
        //发送留言
        $mail= new \App\Mail\SendMail($liuyan);
        \Illuminate\Support\Facades\Mail::to('52828625@qq.com')->send($mail);
       return back()->with('status','提交成功，请等待客户联系');
    }
}
